import redis


# 定义地址和端口
host = '127.0.0.1'
port = 6379

# 建立redis连接
r = redis.Redis(host=host,port=port)

# #声明一个值
# r.set('test','123')

# #取值
# code = r.get('test')

# r.sadd("test","火爆")
# r.sadd("test","修身")

# myset = r.smembers("test")
# print(myset)
# myset = list(myset)
# mytag = str(myset0[0],'utf-8')

# print(mytag)


# 声明周期的使用
# r.set('123','123')
# r.expire('123',10)
print(r.get('123'))
